package com.xdcplus.web.common.pojo.vo.trace;

import cn.hutool.core.collection.CollectionUtil;
import com.xdcplus.web.common.enums.BdOpeEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;

@Data
public class GetPrdInfoTraceVo {
    @ApiModelProperty("工序编码")
    private String opeCode;
    @ApiModelProperty("工序名称")
    private String opeName;
    @ApiModelProperty("硅片ID")
    private String prdCode;
    @ApiModelProperty("进站载具")
    private String lgonBoxCode;
    @ApiModelProperty("出站载具")
    private String lgofBoxCode;
    @ApiModelProperty("进站时间")
    private String lgonEvtTimestamp;
    @ApiModelProperty("出站时间")
    private String lgofEvtTimestamp;
    @ApiModelProperty("主设备")
    private String toolCode;

    @ApiModelProperty("主设备名称")
    private String toolName;
    @ApiModelProperty("子设备")
    private String subToolCode;
    @ApiModelProperty("子设备名称")
    private String subToolName;
    @ApiModelProperty("舟位置")
    private String areaNo;
    @ApiModelProperty("舟号")
    private String boat;
    @ApiModelProperty("产品编号")
    private String mtrlCode;
    @ApiModelProperty("拆包时间")
    private String  fpcbTime;
    @ApiModelProperty("工单号")
    private String  woCode;

    public static List<GetPrdInfoTraceVo> convert(List<GetPrdInfoTraceVo> getPrdInfoTraceVoList){

        if(CollectionUtil.isNotEmpty(getPrdInfoTraceVoList)){
            for(GetPrdInfoTraceVo getPrdInfoTraceVo:getPrdInfoTraceVoList){
                if(BdOpeEnum.FPCB_OPE.getCode().equals(getPrdInfoTraceVo.getOpeCode())){
                    getPrdInfoTraceVo.setLgonEvtTimestamp(getPrdInfoTraceVo.getFpcbTime());
                }
                if("0".equals(getPrdInfoTraceVo.getAreaNo())){
                    getPrdInfoTraceVo.setAreaNo("-");
                }
                if(BdOpeEnum.FPCB_OPE.getCode().equals(getPrdInfoTraceVo.getOpeCode())){
                    getPrdInfoTraceVo.setToolName("-");
                    getPrdInfoTraceVo.setSubToolName("-");
                    getPrdInfoTraceVo.setBoat("-");
                    getPrdInfoTraceVo.setAreaNo("-");
                    getPrdInfoTraceVo.setLgofBoxCode("-");
                    getPrdInfoTraceVo.setLgofEvtTimestamp("-");
                }else if(BdOpeEnum.TEX_OPE.getCode().equals(getPrdInfoTraceVo.getOpeCode())||
                        BdOpeEnum.BSG_OPE.getCode().equals(getPrdInfoTraceVo.getOpeCode()) ||
                        BdOpeEnum.KS_OPE.getCode().equals(getPrdInfoTraceVo.getOpeCode()) ||
                        BdOpeEnum.PSG_OPE.getCode().equals(getPrdInfoTraceVo.getOpeCode()) ||
                        BdOpeEnum.RD_OPE.getCode().equals(getPrdInfoTraceVo.getOpeCode()))
                {
                    getPrdInfoTraceVo.setSubToolName("-");
                    getPrdInfoTraceVo.setBoat("-");
                    getPrdInfoTraceVo.setAreaNo("-");
                }else if(BdOpeEnum.PRT_OPE.getCode().equals(getPrdInfoTraceVo.getOpeCode())){
                    getPrdInfoTraceVo.setBoat("-");
                    getPrdInfoTraceVo.setAreaNo("-");
                    getPrdInfoTraceVo.setLgofBoxCode("-");
                } else if(BdOpeEnum.IVT_OPE.getCode().equals(getPrdInfoTraceVo.getOpeCode())){
                    getPrdInfoTraceVo.setLgonBoxCode("-");
                    getPrdInfoTraceVo.setSubToolName("-");
                    getPrdInfoTraceVo.setBoat("-");
                    getPrdInfoTraceVo.setAreaNo("-");
                }
            }

        }
        return getPrdInfoTraceVoList;

    }

}
